package com.cn.wanxi.dao;

import com.cn.wanxi.service.NavService;
import com.sun.deploy.util.StringUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class NavDao {
    private String[] titles = {"网站首页", "公司介绍", "新闻介绍", "产品介绍", "在线留言", "联系我们"};
    private String[] hrefs = new String[6];

    public NavDao() {
        setHrefs();
    }

    //static {
// setHrefs();
//}
    public void setHrefs() {
        hrefs[0] = "home.html";
        hrefs[1] = "company.html";
        hrefs[2] = "news.html";
        hrefs[3] = "product.html";
        hrefs[4] = "online.html";
        hrefs[5] = "callus.html";


    }

    public String[] getTitles() {
        return titles;
    }

    public String[] getHrefs() {
        return hrefs;
    }


    public List<String> getData() {
//        StringBuilder和StringBuffer和String的区别?
        List<String> list = new ArrayList<>();
//        StringBuilder href = new StringBuilder();
//        for (int i = 0; i < hrefs.length; i++) {
//            if (i != hrefs.length - 1)
//                href.append(hrefs[i]).append(",");
//            else
//                href.append(hrefs[i]);
//        }
        list.add(Arrays.toString(hrefs));
        list.add(Arrays.toString(titles));
        return list;
    }

    public static void main(String[] args) {
//        System.out.println(new NavDao().getData());
    }
}
